﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Resources;
using System.Windows.Forms;

namespace SMS.util
{
    public class I18nUtil
    {
        private static CultureInfo culture;
        private static ResourceManager rm;
        private static readonly I18nUtil INSTANCE = new I18nUtil();
        private static readonly String RESOURECE_PATH = "SMS.Properties.Resources";
        private static readonly String VN_LANGUAGE = "vi-VN";
        private static readonly String US_LANGUAGE = "en-US";

        public I18nUtil() { }

        public static I18nUtil Instance
        {
            get
            {
                return INSTANCE;
            }
        }

        public static String vnLang
        {
            get
            {
                return VN_LANGUAGE;
            }
        }

        public static String usLang
        {
            get
            {
                return US_LANGUAGE;
            }
        }

        public static String resourcePath
        {
            get
            {
                return RESOURECE_PATH;
            }
        }

        public static String getString(String i18n)
        {
            return rm.GetString(i18n, culture);
        }

        public static void init(String lang, ResourceManager resourceManager)
        {
            culture = CultureInfo.CurrentCulture;
            culture = CultureInfo.CreateSpecificCulture(lang);
            rm = resourceManager;
        }

    }
}
